# Maintainer: Alexandre Ferreira < alex.jorge.m [at] gmail.com >

_realname=wcwidth
pkgbase=python-${_realname}
pkgname=("python-${_realname}")
pkgver=0.2.5
pkgrel=1
pkgdesc='Measures number of Terminal column cells of wide-character codes'
url='https://github.com/jquast/wcwidth'
arch=('i686' 'x86_64')
license=('MIT')
depends=('python')
makedepends=('python-setuptools')
#checkdepends=("python-tox")
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/jquast/${_realname}/archive/${pkgver}.tar.gz")
sha256sums=('b08fa4c7d7be1ba86950c2d746eb0d19de80842ab7457df5b3fcd3bf52e02b08')
noextract=("${_realname}-${pkgver}.tar.gz")

prepare() {
  [[ -d ${srcdir}/${_realname}-${pkgver} ]] && rm -rf ${srcdir}/${_realname}-${pkgver}
  bsdtar -xzf ${srcdir}/${_realname}-${pkgver}.tar.gz -C $srcdir || true
  bsdtar -xzf ${srcdir}/${_realname}-${pkgver}.tar.gz -C $srcdir || true

  rm -rf python-build-${CARCH} | true
  cp -r "${_realname}-${pkgver}" "python-build-${CARCH}"
}

build() {
  cd "${srcdir}/python-build-${CARCH}"
  /usr/bin/python setup.py build
}

#check() {
#    cd ${srcdir}/python-build-${CARCH}
#    tox
#}

package() {
  cd "${srcdir}/python-build-${CARCH}"
  /usr/bin/python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/python-${_realname}/LICENSE"
}
